const checkCardNo = (rule, value, callback) => {
  // 身份证号
  const regIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
  if (!value) {
    return callback(new Error('必须填写证件号码'))
  } else if (rule.card_type === '1' && !regIdCard.test(value)) {
    return callback(new Error('身份证号格式错误'))
  } else {
    return callback()
  }
  // 军官证或士兵证
  // const regOfficer = /^[a-zA-Z0-9]{7,21}$/
  // 港澳通行证
  // const regHK = /^[a-zA-Z0-9]{5,21}$/
  // if (!value) {
  //   return callback(new Error('必须填写证件号码'))
  // } else if (rule.card_type === '1' && !regIdCard.test(value)) {
  //   return callback(new Error('身份证号错误'))
  // } else if (rule.card_type === '2' && !regOfficer.test(value)) {
  //   return callback(new Error('军官证号错误'))
  // } else if (rule.card_type === '4' && !regHK.test(value)) {
  //   return callback(new Error('港澳通行证号错误'))
  // } else {
  //   return callback()
  // }
}
export default {
  ruleValidate: {
    person_name: [{ required: true, message: '必填项', trigger: 'blur' }],
    id_card: [{ required: true, message: '必填项', validator: checkCardNo, trigger: 'blur' }],
    phone: [{ required: true, message: '必填项', trigger: 'blur' }],
    home_address: [{ required: true, message: '必填项', trigger: 'blur' }],
    service_address: [{ required: true, message: '必填项', trigger: 'blur' }],
    person_type: [{ required: true, message: '必填项', trigger: 'change' }],
    person_desc: [{ required: true, message: '必填项', trigger: 'blur' }]
  },
  areaList: [
    {
      label: '沈阳市',
      value: '沈阳市'
    },
    {
      label: '沈河区',
      value: '沈河区'
    },
    {
      label: '铁西区',
      value: '铁西区'
    },
    {
      label: '和平区',
      value: '和平区'
    },
    {
      label: '皇姑区',
      value: '皇姑区'
    },
    {
      label: '大东区',
      value: '大东区'
    },
    {
      label: '于洪区',
      value: '于洪区'
    },
    {
      label: '浑南区',
      value: '浑南区'
    },
    {
      label: '沈北新区',
      value: '沈北新区'
    },
    {
      label: '康平县',
      value: '康平县'
    },
    {
      label: '法库县',
      value: '法库县'
    },
    {
      label: '新民市',
      value: '新民市'
    },
    {
      label: '辽中区',
      value: '辽中区'
    },
    {
      label: '苏家屯区',
      value: '苏家屯区'
    }
  ]
}
